#ifndef __INETADDRESS_H__
#define __INETADDRESS_H__

#include <netinet/in.h>
#include <string>

using std::string;

class InetAddress
{
public:
    //InetAddress(const string ip="0.0.0.0", int port=8888);
    InetAddress(string ip, int port);
	
	//InetAddress(const string ip="0.0.0.0", const string port="8888");
	InetAddress(string ip, string port);

    InetAddress(struct sockaddr_in &addr);

    struct sockaddr_in *getAddr() {return &addr_;}

    void printAddr();

	string ip();
	int port();

	static int str2int(const string str);

private:
    struct sockaddr_in addr_;
};

#endif
